from flask import Blueprint, jsonify
from flask import current_app
from flask import request

from ihome_tenancy import db
from ihome_tenancy.models import Order, House
from ihome_tenancy.utils.response_code import RET

order_blueprint = Blueprint('order',__name__)

@order_blueprint.route('/<int:id>', methods=['GET', 'POST'])
def stutas(id):
    stutas=request.form.get('status')
    order=Order.query.get(id)
    order.status=stutas

    if stutas=='REJECTED':
        order.comment=request.form.get('comment')

    order.add_update()
    return jsonify(errno=RET.OK,errmsg="")



